
SWEP.Category 		= "HL2 Beta Sweps"
SWEP.Author			= "Valve"
SWEP.Instructions	= "Primary=Shoot Secondary=Zoom"
SWEP.Contact		= "n/a"
SWEP.Purpose		= "To be a combine sniper"
SWEP.PrintName		= "Sniper Rifle"

SWEP.ViewModelFOV	= 55
SWEP.ViewModelFlip	= false

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= false

SWEP.ViewModel      = "models/ctf_weapons/v_sniper.mdl"
SWEP.WorldModel     = "models/ctf_weapons/w_sniper.mdl"
  
-------------Primary Fire Attributes----------------------------------------
SWEP.Primary.Delay			= 0.2 	--In seconds
SWEP.Primary.Recoil			= 4		--Gun Kick
SWEP.Primary.NumShots		= 1		--Number of shots per one fire
SWEP.Primary.Cone			= 0.00001 	--Bullet Spread
SWEP.Primary.ClipSize		= 1	--Use "-1 if there are no clips"
SWEP.Primary.DefaultClip	= 7	--Number of shots in next clip
SWEP.Primary.Automatic   	= false	--Pistol fire (false) or SMG fire (true)
SWEP.Primary.Ammo         	= "SniperRound"	--Ammo Type
 
-------------Secondary Fire Attributes-------------------------------------
SWEP.Secondary.Delay		= 0
SWEP.Secondary.Recoil		= 0
SWEP.Secondary.Damage		= 0
SWEP.Secondary.Cone			= 0
SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic   	= false
SWEP.Secondary.Ammo         = "none"

util.PrecacheSound("weapons/sniper/sniper_fire.wav")
util.PrecacheSound("weapons/sniper/sniper_reload.wav")
util.PrecacheSound("weapons/sniper/sniper_zoomout.wav")
util.PrecacheSound("weapons/sniper/sniper_zoomin.wav")

function SWEP:Initialize()
	if( SERVER ) then
		self:SetWeaponHoldType( "ar2" );
	end

end

function SWEP:Precache()
end

function SWEP:PrimaryAttack()

	if ( !self:CanPrimaryAttack() ) then

		self:ShootBullet( 60, 1, 0 )
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.2 )
		self:EmitSound( Sound("weapons/sniper/sniper_fire.wav") )
		self:TakePrimaryAmmo( 1 )
                self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
         end
	
function SWEP:SecondaryAttack()

	if(ScopeLevel == 0) then

        	if(SERVER) then
            		self.Owner:SetFOV( 30, 0 )
                self:EmitSound("weapons/sniper/sniper_zoomout.wav")
                end

        	ScopeLevel = 1

	else if(ScopeLevel == 1) then

		if(SERVER) then
			self.Owner:SetFOV( 10, 0 )
                self:EmitSound("weapons/sniper/sniper_zoomin.wav")
                end

		ScopeLevel = 2

	else

        	if(SERVER) then
			self.Owner:SetFOV( 0, 0 )
                self:EmitSound("weapons/sniper/sniper_zoomin.wav")
                end

        	ScopeLevel = 0
                 
        end

end	


function SWEP:Reload()
        if self:DefaultReload(ACT_VM_RELOAD) then
	        self.Weapon:EmitSound("weapons/sniper/sniper_reload.wav")
        end
end
